﻿

using System.Collections.Generic;
using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel;

namespace Microsoft.Practices.EnterpriseLibrary.Data.Configuration
{
	/// <summary>
	/// Describes a <see cref="Database"/> instance, aggregating information from a <see cref="ConnectionStringSettings"/>
	/// and potentially other sources of configuration.
	/// </summary>
	public abstract class DatabaseData
	{
		protected DatabaseData(ConnectionStringSettings connectionStringSettings, IConfigurationSource configurationSource)
		{
			ConnectionStringSettings = connectionStringSettings;
			ConfigurationSource = configurationSource;
		}

		///<summary>
		/// Gets the <see cref="IConfigurationSource"/> for the database data.
		///</summary>
		protected IConfigurationSource ConfigurationSource { get; private set; }

		/// <summary>
		/// Gets the <see cref="ConnectionStringSettings"/> for the database data.
		/// </summary>
		protected ConnectionStringSettings ConnectionStringSettings { get; private set; }

		/// <summary>
		/// Creates a <see cref="TypeRegistration"/> instance describing the database represented by 
		/// this configuration object.
		/// </summary>
		/// <returns>A <see cref="TypeRegistration"/> instance describing a database.</returns>
		public abstract IEnumerable<TypeRegistration> GetRegistrations();

	}
}